package com.clz.festec;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Toast;

import com.clz.latte.delegate.LatteDaleGate;
import com.clz.latte.net.RestClient;
import com.clz.latte.net.callback.IError;
import com.clz.latte.net.callback.IFailure;
import com.clz.latte.net.callback.ISuccess;


/**
 * Created by Administrator on 2017/11/16.
 */

public class ExampleDaleGate extends LatteDaleGate {
    @Override
    public Object setLayOut() {
        return R.layout.delegate_example;
    }

    @Override
    public void onBindView(@Nullable Bundle savedInstanceState, View rootView) {
       // testRestClient();
    }

    private void testRestClient() {
        RestClient.builder()
                .url("http://192.168.1.107:82/RestServer/api/")
                .loader(getContext())
                .sucess(new ISuccess() {
                    @Override
                    public void onSucess(String response) {
                        Toast.makeText(getActivity(), response, Toast.LENGTH_LONG).show();
                    }
                })
                .error(new IError() {
                    @Override
                    public void onError(int code, String message) {

                    }
                })
                .failure(new IFailure() {
                    @Override
                    public void onFailure() {

                    }
                })
                .build()
                .get();
    }

}
